import requests


def face_analyze(API_KEY, API_S, face_tokens, landmark=1, attributes=None, face_rectangle=None,
                 beauty_score_min=0, beauty_score_max=100):
    """该函数为调用face++ face_analyze接口"""
    base_url = 'https://api-cn.faceplusplus.com/facepp/v3/face/analyze'
    payload = {
        'api_key': API_KEY,
        'api_secret': API_S,
        'face_tokens': face_tokens,
        'face_tokens': face_tokens,
        'return_landmark': landmark,
        'return_attributes': attributes,
        'face_rectangle': face_rectangle,
        'beauty_score_min': beauty_score_min,
        'beauty_score_max': beauty_score_max
    }

    r = requests.post(base_url, params=payload)
    return r.json()